package org.blog.com.spring_blog.model;

import lombok.Data;
import org.blog.com.spring_blog.enums.ResultStatus;

@Data
public class Result<T> {
    private String ErrMsg;
    private T data;
    private ResultStatus code;

    public static<T> Result<T> success(T data){
        Result<T> result=new Result<>();
        result.setCode(ResultStatus.SUCCESS);
        result.setData(data);
        result.setErrMsg("");
        return result;
    }
    public static<T> Result<T> fail(String errMsg){
        Result<T> result=new Result<>();
        result.setCode(ResultStatus.FAIL);
        result.setErrMsg("errMsg");
        return result;
    }
}
